package network.step1;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

public class SimpleClient1 {
	
	public static void main(String[] args) throws IOException {
		Socket socket = null;
		PrintWriter out = null;
		
		try{
			//1. 네트워크 연결
			socket = new Socket("127.0.0.1",5000);
			//2. I/O작업
			//2-1. Socket으로부터 Stream 조회 + filter 추가
			out = new PrintWriter(socket.getOutputStream());
			//2-2. 출력
			out.println("Hello");
			out.println("반갑습니다");
			out.println("fkffkfkfkfkfkf");
			System.out.println("----------------모든 문장을 서버로 전송했습니다.---------------------");
		}finally{
			//3.close
			if(out != null) out.close();
			if(socket != null) socket.close();
		}
		
	}
}
